<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML LANG="EN-US">
<HEAD>
<TITLE>VT100.net: VT330/VT340 Programmer Reference Manual</TITLE>
<LINK HREF="vt330.css" TYPE="text/css" REL="stylesheet">
</HEAD>
<BODY>
<DIV CLASS="navbar"><A HREF="http://vt100.net/"><IMG CLASS="button" SRC="vt100.net-logo.png" ALT="VT100.net" HEIGHT="16" WIDTH="102"></A> VT330/VT340 Programmer Reference Manual Volume 2: Graphics Programming<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="chapter4.html">Chapter 4</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="chapter6.html">Chapter 6</A></TD>
</TR>
</TBODY>
</TABLE>
<HR></DIV>
<H1 ID="S5"><SPAN CLASS="chapnum">5</SPAN> Vector Command</H1>
<P>You use vector commands to draw lines. The terminal draws a line between the
cursor position and the position you specify in a vector command. Usually, the
terminal draws solid lines that are 1 pixel wide. However, you can change the
appearance of lines by using the options for the write control command
(<A HREF="chapter3.html">Chapter 3</A>).</P>
<P>There are four basic options for the vector command.</P>
<UL>
<LI>Draw dot arguments</LI>
<LI>Draw line arguments</LI>
<LI>Position stack options</LI>
<LI>Temporary writing controls</LI>
</UL>
<H2 ID="S5.1">About the Examples</H2>
<P>This chapter includes several examples of figures drawn with vector commands.
The following write control and screen command values are in effect for these
examples.</P>
<P><STRONG>Write Controls in Effect</STRONG></P>
<P CLASS="example">W(N0,I0,F3,P1(M2),V,M1,S0)</P>
<P>where</P>
<DIV CLASS="example"><P><B>W</B> identifies the write control command.</P>
<TABLE CLASS="padded">
<COL ALIGN="RIGHT">
<COL SPAN="2" ALIGN="LEFT">
<TBODY>
<TR VALIGN="TOP">
<TD><B>N0</B></TD>
<TD>=</TD>
<TD>negative writing off.</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>I0</B></TD>
<TD>=</TD>
<TD>foreground writing uses output map location 0 (with default setting of dark).</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>F3</B></TD>
<TD>=</TD>
<TD>writing affects both bitmap planes.</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>P1(M2)</B></TD>
<TD>=</TD>
<TD>writing uses standard pattern 1, with a multiplication factor of 2.</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>V</B></TD>
<TD>=</TD>
<TD>overlay writing is in effect.</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>M1</B></TD>
<TD>=</TD>
<TD>PV multiplication factor is 1.</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>S0</B></TD>
<TD>=</TD>
<TD>shading is off.</TD>
</TR>
</TBODY>
</TABLE></DIV>
<P><STRONG>Screen Controls in Effort</STRONG></P>
<P CLASS="example">S(I3,T0,A[0,0][799,479])</P>
<P>where</P>
<DIV CLASS="example"><P><B>S</B> identifies the screen control command.</P>
<TABLE CLASS="padded">
<COL ALIGN="RIGHT">
<COL SPAN="2" ALIGN="LEFT">
<TBODY>
<TR VALIGN="TOP">
<TD><B>I3</B></TD>
<TD>=</TD>
<TD>background shade/color is white (default for output map location 3).</TD>
</TR>
<TR VALIGN="TOP">
<TD><B>A[0,0][799,479]</B></TD>
<TD>=</TD>
<TD>default screen address is in effect.</TD>
</TR>
</TBODY>
</TABLE></DIV>
<H2 ID="S5.2">Draw Dot</H2>
<P>This argument lets you draw a dot at the cursor position. The dot is a single
pixel. You use the following format for the draw dot argument.</P>
<P CLASS="example">V[]</P>
<P>where</P>
<DIV CLASS="example"><P><B>V</B> identifies the vector command.</P>
<P><B>[]</B> is a null position argument that tells ReGIS to draw a dot.</P></DIV>
<H2 ID="S5.3">Draw Line</H2>
<P>This argument draws a straight line from the cursor position to a position you
specify. ReGIS draws each line in the currently selected pattern (<A HREF="chapter3.html">Chapter 3</A>).
The pattern repeats every 8 pixels. The default pattern is a solid line (P1).</P>
<P>If you use dotted or dashed lines, the results are unpredictable where lines intersect.
However, you can start any line at the first position of the pattern by
repeating the V command key letter.</P>
<P>You can specify the endpoint of a line in four different ways.</P>
<UL>
<LI>absolute position</LI>
<LI>relative position</LI>
<LI>absolute/relative position</LI>
<LI>PV offset position</LI>
</UL>
<P>The arguments above are the same arguments used for the position command.
See "<A HREF="chapter4.html#S4.1">Set Position Arguments</A>" in <A HREF="chapter4.html">Chapter 4</A> for the command format. For draw
line commands, you would begin with a <B>V</B> instead of a <B>P</B>.</P>
<P CLASS="note">NOTE: You do not have to start a new vector command when you change
argument types.</P>
<P><A HREF="#F5-1">Figure 5-1</A> shows a simple bar graph drawn using absolute, relative, and
absolute/relative positions. <A HREF="#F5-2">Figure 5-2</A> shows a graphic image of the PV directions
used in the pixel vector system. The image was drawn using PV
multiplication.</P>
<TABLE ID="F5-1" CLASS="figure" WIDTH="100%">
<CAPTION>Figure 5-1 Bar Graph Using Vector Draw Line Arguments</CAPTION>
<COL ALIGN="CENTER">
<TBODY>
<TR>
<TD><IMG SRC="ma-0704-83.png" ALT=""></TD>
</TR>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<COL ALIGN="RIGHT">
<COL ALIGN="LEFT">
<TBODY>
<TR>
<TD COLSPAN="2" ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR VALIGN="TOP">
<TD>(1)<BR>(2)<BR>(3)<BR>(4)<BR>(5)<BR>(6)<BR>(7)<BR>(8)<BR>(9)<BR>(10)<BR>(11)<BR>(12)<BR>(13)<BR>(14)<BR>(15)</TD>
<TD>P[100,100]<BR>V[,400]<BR>[500]<BR>P[-400,200]<BR>V[200]<BR>[,400]<BR>[,-100]<BR>[+100]<BR>[,+100]<BR>[,-150]<BR>[+100]<BR>[,+150]<BR>[,-20]<BR>[+100]<BR>[,+20]</TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<TABLE ID="F5-2" CLASS="figure" WIDTH="100%">
<CAPTION>Figure 5-2 Image of PV Directions, Drawn with PV Offset and PV Multiplication Options</CAPTION>
<COL ALIGN="CENTER">
<COL WIDTH="480" ALIGN="RIGHT">
<TBODY>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<TBODY>
<TR>
<TD ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR VALIGN="TOP">
<TD>P[400,200]<BR>V(W(M100))<BR>622637731551044</TD>
</TR>
</TBODY>
</TABLE></TD>
<TD><IMG SRC="ma-0705-83r.png" ALT=""></TD>
</TR>
<TR>
<TD></TD>
<TD ALIGN="LEFT"><SMALL>NOTE:<BR>Cursor is shown at an arbitrary starting position [100,100],
and at ending position [300,200].<BR>&nbsp;</SMALL></TD>
</TR>
</TBODY>
</TABLE>
<H2 ID="S5.4">Position Stack Options</H2>
<P>A position stack is a set of coordinates that ReGIS uses in sequence. These
options let you process a group of vectors as a unit. Both options use at least
one start (or begin) option and one end option. You can embed position (P) and
curve (C) commands in the options.</P>
<P>There are two types of position stack options.</P>
<UL>
<LI>Bounded stack</LI>
<LI>Unbounded stack</LI>
</UL>
<H3 ID="S5.4.1">Bounded Position Stack</H3>
<P>You can use bounded position stacks to connect the last vector of a command
to the starting position of the command. For example, you can use bounded
position stacks to draw closed polygons.</P>
<P>The bounded position stack option for the vector command works in the same as
in a position command (<A HREF="chapter4.html">Chapter 4</A>). At the beginning of the option, ReGIS
saves the current active position by pushing the position onto the stack. At the
end of the option, ReGIS returns the cursor to the saved position by popping
the position off the stack.</P>
<P>You use the following format for a bounded position stack.</P>
<P CLASS="example">V(B)&lt;embedded options&gt;(E)</P>
<P>where</P>
<DIV CLASS="example"><P><B>(B)</B> saves the current active position by pushing the position onto the
stack. This is the starting point for a line.</P>
<P><B>&lt;embedded options&gt;</B> are the position, vector, curve, and other command
options you use in the position stack option.</P>
<P><B>(E)</B> returns the cursor to the position saved by the previous (B) option.
(Pops the position off the stack.) ReGIS draws a line from the (B) position
to the position specified before (E).</P></DIV>
<P>A bounded position stack option has at least one begin (B) option and one end
(E) option. Each (B) option stores the coordinates of the current cursor position
on the stack. Each (E) option returns the cursor to the position stored by the previous
(B) option. A position stack can have up to 16 (B) options. For each (B)
option, there must be a corresponding (E) option.</P>
<P CLASS="note">NOTE: The terminal saves cursor positions during bounded and unbounded
stack options for vector (V) commands and position (P) commands (<A HREF="chapter4.html">Chapter 4</A>).
The limit for unended, saved positions (including all save commands) is 16.
However, for compatibility with other ReGIS products, use a maximum of
eight.</P>
<P><A HREF="#F5-3">Figure 5-3</A> shows an example of a graphic image drawn using a bounded position
stack option. The stack has two (B) and (E) options, with embedded curve
(C) commands. <A HREF="#F5-4">Figure 5-4</A> shows examples of simple graphic images drawn
using bounded position stacks.</P>
<TABLE ID="F5-3" CLASS="figure" WIDTH="100%">
<CAPTION>Figure 5-3 Bounded Position Stack Example, Using Multiple (B) Options</CAPTION>
<COL ALIGN="CENTER">
<TBODY>
<TR>
<TD><IMG SRC="ma-0706-83.png" ALT=""></TD>
</TR>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<TBODY>
<TR>
<TD ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR VALIGN="TOP">
<TD>P[200,100]<BR>V(B)<BR>[200,200]<BR>(B)<BR>[400,300]<BR>[300,400]<BR>(E)<BR>C[+20]<BR>V[100,50]<BR>(E)<BR>C[+20]</TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<TABLE ID="F5-4" CLASS="figure" WIDTH="100%">
<CAPTION>Figure 5-4 Bounded Position Stack Examples</CAPTION>
<COL ALIGN="CENTER">
<TBODY>
<TR>
<TD><IMG SRC="ma-0708-83.png" ALT=""></TD>
</TR>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<TBODY>
<TR>
<TD COLSPAN="5" ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR>
<TH CLASS="c">(A)</TH>
<TH CLASS="c">(B)</TH>
<TH CLASS="c">(C)</TH>
<TH CLASS="c">(D)</TH>
<TH CLASS="c">(E)</TH>
</TR>
<TR VALIGN="TOP">
<TD>P[100,100]<BR>V(B)<BR>[+100]<BR>[,+100]<BR>[-100]<BR>(E)</TD>
<TD>P[350,100]<BR>V(B)<BR>[+100]<BR>[,+100]<BR>(E)</TD>
<TD>P[650,150]<BR>V(B)<BR>[700,200]<BR>[,-100]<BR>[-100]<BR>[,+100]<BR>(E)</TD>
<TD>P[400,340]<BR>V(B)<BR>[450,400]<BR>[-100]<BR>(E)</TD>
<TD>V(B)<BR>[350,250]<BR>[+100]<BR>(E)</TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE>
<H3 ID="S5.4.2">Unbounded Position Stack</H3>
<P>An unbounded position stack works the same as a bounded one, except the
active position does not move at the end of an unbounded stack. An unbounded
stack begins with an (S) option rather than a (B) option.</P>
<P>The (S) option saves a dummy, or nonexistent position by pushing it onto the
stack. When ReGIS comes to an (E) option, the cursor stays at the position
specified before the (E) option. You use the following format for an unbounded
position stack.</P>
<P CLASS="example">V(S)&lt;embedded options&gt;(E)</P>
<P>where</P>
<DIV CLASS="example"><P><B>(S)</B> saves a dummy position by pushing the position onto the stack.</P>
<P><B>&lt;embedded options&gt;</B> are the position, vector, curve and other command
options you use in the position stack option.</P>
<P><B>(E)</B> pops the dummy position saved by the last (S) off the stack. The cursor
does not move.</P></DIV>
<P>The unbounded position stack serves little purpose for images drawn with vector
commands. This stack provides symmetry with the unbounded position
stack of the curve command.</P>
<P><A HREF="#F5-5">Figure 5-5</A> shows an image drawn with an unbounded position stack. The commands
are the same ones used in the bounded position stack for <A HREF="#F5-3">Figure 5-3</A>.
You can compare the results.</P>
<TABLE ID="F5-5" CLASS="figure" WIDTH="100%">
<CAPTION>Figure 5-5 Unbounded Position Stack Example</CAPTION>
<COL ALIGN="CENTER">
<COL WIDTH="480" ALIGN="RIGHT">
<TBODY>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<TBODY>
<TR>
<TD ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR VALIGN="TOP">
<TD>P[200,100]<BR>V(S)<BR>[200,200]<BR>(B)<BR>[400,300]<BR>[300,400]<BR>(E)<BR>C[+20]<BR>V[100,50]<BR>(E)<BR>C[+20]</TD>
</TR>
</TBODY>
</TABLE></TD>
<TD><IMG SRC="ma-0707-83.png" ALT=""></TD>
</TR>
<TR>
<TD></TD>
<TD ALIGN="LEFT"><SMALL>NOTE:<BR>Cursor is shown at arbitrary starting position of [300,100], and at starting [200,100]
and ending [100,50] positions for sequence.<BR>&nbsp;</SMALL></TD>
</TR>
</TBODY>
</TABLE>
<H2 ID="S5.5">Temporary Write Control</H2>
<P>The write control options in <A HREF="chapter3.html">Chapter 3</A> control the appearance of the images
you draw. For example, these options control the shade or color of images.
When you use vector commands, ReGIS uses the current settings for the write
control options.</P>
<P>You can use a temporary write control option to temporarily change one or
more of these settings for a vector command. The temporary values remain in
effect until you use one of the following commands.</P>
<UL>
<LI>another temporary write control option</LI>
<LI>any command that begins with a command key letter, such as a vector (V) command or
another curve (C) command</LI>
<LI>a resynchronization command (semicolon)</LI>
</UL>
<P>When you use one of the above commands, the writing control options return
to their previous values.</P>
<P>You include the temporary write control option in your vector command. You
can use any write control option from <A HREF="chapter3.html">Chapter 3</A>.</P>
<UL>
<LI>PV multiplication</LI>
<LI>Pattern control</LI>
<LI>Foreground intensity</LI>
<LI>Plane select control</LI>
<LI>Overlay writing</LI>
<LI>Replace writing</LI>
<LI>Complement writing</LI>
<LI>Erase writing</LI>
<LI>Negative pattern control</LI>
</UL>
<P>You use the following format for the temporary write control option.</P>
<P CLASS="example">V(W(&lt;suboptions&gt;)&lt;arguments&gt;)</P>
<P>where</P>
<DIV CLASS="example"><P><B>W</B> identifies a temporary write control option.</P>
<P><B>&lt;suboptions&gt;</B> are the temporary write control values selected.</P>
<P><B>&lt;arguments&gt;</B> are vector command arguments that will use the temporary
write control values.</P></DIV>
<P><A HREF="#F5-6">Figure 5-6</A> shows some images that use temporary write control options to
change the drawing pattern used. For more complex examples, see the
"<A HREF="chapter3.html#S3.7">Shading Control</A>" section in <A HREF="chapter3.html">Chapter 3</A>.</P>
<DIV CLASS="centrefig"><TABLE ID="F5-6" CLASS="figure" WIDTH="480">
<CAPTION>Figure 5-6 Temporary Write Control Example</CAPTION>
<COL ALIGN="CENTER">
<TBODY>
<TR>
<TD><IMG SRC="ma-0709-83.png" ALT=""></TD>
</TR>
<TR>
<TD ALIGN="LEFT"><SMALL>NOTE:<BR>
Cursor is shown at arbitrary start position of screen origin [0,0], and at start and end positions for each
graphic. Writing controls in effect are: W(N0,I0,V,P1(M2)), with I0 at default value of dark, background
specifier at S(I3), and I3 at default value of white.<BR>&nbsp;</SMALL></TD>
</TR>
<TR>
<TD><TABLE CLASS="command-example" FRAME="BORDER" RULES="GROUPS" CELLSPACING="0" CELLPADDING="8">
<TBODY>
<TR>
<TD COLSPAN="3" ALIGN="CENTER">COMMANDS</TD>
</TR>
</TBODY>
<TBODY>
<TR>
<TH CLASS="c">(A)</TH>
<TH CLASS="c">(B)</TH>
<TH CLASS="c">(C)</TH>
</TR>
<TR VALIGN="TOP">
<TD>P[100,100]<BR>V(W(P2(M5)))<BR>[+100]<BR>[,+100]<BR>[-100]<BR>[,-100]</TD>
<TD>P[300,100]<BR>V(W(P4(M5)))<BR>[+100]<BR>V[,+100]<BR>[300,100]</TD>
<TD>P[500,150]<BR>V(W(P2(M5)))<BR>[,-75]<BR>[+200]<BR>[,+75]<BR>V[-200]</TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
</TBODY>
</TABLE></DIV>
<H2 ID="S5.6">Vector Command Summary</H2>
<P><A HREF="#T5-1">Table 5-1</A> is a summary of the <B>V</B> command options. There are no default values
for these options.</P>
<TABLE ID="T5-1" CLASS="summarytable" FRAME="VOID" RULES="GROUPS" CELLSPACING="0" CELLPADDING="4">
<CAPTION>Table 5-1 Vector Command Summary</CAPTION>
<COL WIDTH="25%">
<COL WIDTH="75%">
<THEAD>
<TR VALIGN="BOTTOM">
<TH>Option</TH>
<TH>Description</TH>
</TR>
</THEAD>
<TBODY>
<TR VALIGN="TOP">
<TD>[]</TD>
<TD><P><STRONG>Draw dot</STRONG><BR>
Draws one dot (a single pixel at the current active position. Does not move the cursor.</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>[X,Y]</TD>
<TD><P><STRONG>Draw line (with coordinate)</STRONG><BR>
Draws a line from the current active position to the [X,Y]
position. You can use absolute, relative, or absolute/relative values for [X,Y].</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>&lt;PV&gt;</TD>
<TD><P><STRONG>Draw line (with PV value)</STRONG><BR>
Draws a line from the current active position to a relative position defined by &lt;PV&gt;.
The PV value defines a direction.</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>(B)</TD>
<TD><P><STRONG>Begin a bounded position stack</STRONG><BR>
Saves the current active position by pushing it on the stack. This is the starting point for a line.</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>(S)</TD>
<TD><P><STRONG>Start an unbounded position stack</STRONG><BR>
Saves a dummy position, by pushing it onto the stack.</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>(E)</TD>
<TD><P><STRONG>End of bounded position stack</STRONG><BR>
Draws a line to the position saved by the previous (B) option from the position specified before the (E) option.
Then pops the saved position off the stack.</P>
<P><STRONG>End of unbounded position stack</STRONG><BR>
Ends a position stack started by an (S) option. No line is drawn, and the active position does not move.</P></TD>
</TR>
<TR VALIGN="TOP">
<TD>(W(&lt;suboptions&gt;))</TD>
<TD><P><STRONG>Temporary write control</STRONG><BR>
Lets you use temporary write control values with one vector command. Temporary values only remain in effect
for the selected command.</P></TD>
</TR>
</TBODY>
</TABLE>
<DIV CLASS="navbar"><HR>
<TABLE WIDTH="100%">
<COL SPAN="3" WIDTH="33%">
<TBODY>
<TR>
<TD ALIGN="LEFT"><A HREF="chapter4.html">Chapter 4</A></TD>
<TD ALIGN="CENTER"><A HREF="contents.html">Contents</A></TD>
<TD ALIGN="RIGHT"><A HREF="chapter6.html">Chapter 6</A></TD>
</TR>
</TBODY>
</TABLE>
<DIV CLASS="navbot">http://vt100.net/docs/vt3xx-gp/chapter5.html</DIV></DIV>
</BODY>
</HTML>
